<template>
	<view>
		<header-vue bgColor="transparent" :backOpBg="true"></header-vue>
		<view class="swiper">
			<!-- <u-swiper height="100%" :list="list" @change="e => currentNum = e.current" :autoplay="false"
				:indicatorStyle="{right: '32rpx', bottom: '12rpx'}">
				<view slot="indicator" class="flex indicator-num">
					<text class="indicator-num__text font24">{{ currentNum + 1 }}/{{ list.length }}</text>
				</view>
			</u-swiper> -->
		</view>
		<view class="detail">
			<view class="white-box font24">
				<view class="flex">
					<image :src="IMAGE_URL + '/static/login/bg.png'" class="cover"></image>
					<view class="flex column between store">
						<view class="flex between" style="width: 100%;">
							<view style="flex: 1;width: 0;">
								<view class="font32 fontbold-500 store-title ellipsis">津市牛肉粉津市牛肉粉津市牛肉粉津市牛肉粉津市牛肉粉</view>
								<view class="flex start star">
									<view v-for="starIndex in 5" class="iconfont icon-starFull font28"
										style="margin-right: 8rpx;"
										:style="{color: starIndex < 3 ? '#FF4040' : '#FFD2D2'}"></view>
								</view>
							</view>
							<view class="flex btn-guanzhu font32">
								<i class="iconfont icon-add font28"></i>
								关注
							</view>
						</view>
						<view class="flex between fans">
							<view>6999粉丝</view>
							<view>￥50/人</view>
						</view>
					</view>
				</view>
				<view class="address font24">
					<view class="flex start mt-20" style="align-items: flex-start">
						<i class="iconfont icon-dingwei font24"></i>
						<view>距您244m，万福路888号长沙汇金购物中心商城L6层展示一行</view>
					</view>
					<view class="flex between mt-20">
						<view class="flex start">
							<i class="iconfont icon-clock font24"></i>
							<view>营业中：10:00 - 22:00</view>
						</view>
						<view class="flex start">
							<i class="iconfont icon-kefu font24"></i>
							<view>联系客服</view>
						</view>
					</view>
				</view>
			</view>
			<view class="white-box font28" style="padding: 0 32rpx;">
				<view class="flex between item">
					<view class="flex">
						<image :src="IMAGE_URL + '/static/shop/sjzz.png'"></image>
						<view>商家资质</view>
					</view>
					<i class="iconfont icon-jiantou font28"></i>
				</view>
			</view>
			<view class="goods-list white-box">
				<view class="flex star font28 tab">
					<view class="flex column" :class="{active: !tabIndex}" @click="tabIndex = 0">
						<view>商品列表</view>
						<i class="iconfont icon-tab-circle"></i>
					</view>
					<view class="flex column" :class="{active: tabIndex}" @click="tabIndex = 1">
						<view>团购</view>
						<i class="iconfont icon-tab-circle"></i>
					</view>
				</view>
				<view v-for="item in 10" :key="item" class="white-box list">
					<view class="flex between store-title font24">
						<view>距结束:</view>
						<view class="flex center font20">
							<view class="flex center time-red-box font16">00</view>
							<view>时</view>
							<view class="flex center time-red-box font16">00</view>
							<view>分</view>
							<view class="flex center time-red-box font16">00</view>
							<view>秒</view>
						</view>
					</view>
					<view class="flex">
						<image :src="IMAGE_URL + '/static/login/bg.png'"></image>
						<view class="flex column between start store-info">
							<view>
								<view class="flex start">
									<view class="tag font20">自营</view>
									<view class="font28 fontbold-500">巴旦木去核奶枣零食夹心</view>
								</view>
								<view class="sale-num font24">已售36</view>
							</view>
							<view class="flex between font20 num">
								<view class="flex price">
									<text class="font28">￥</text>
									<text class="font36">63</text>
									<text class="font28">.10</text>
								</view>
								<view class="flex">
									<view class="flex">
										<i class="iconfont icon-like font28"></i>
										80.1%
									</view>
									<view class="flex">
										<i class="iconfont icon-comment font28"></i>
										2041
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="flex between fixed">
			<view class="flex start">
				<view class="item font20">
					<i class="iconfont icon-store font40"></i>
					<view>店铺</view>
				</view>
				<view class="item font20">
					<i class="iconfont icon-kefu font40"></i>
					<view>客服</view>
				</view>
				<view class="item font20">
					<i class="iconfont icon-star font40"></i>
					<view>收藏</view>
				</view>
			</view>
			<view class="flex font36 fontbold-500">
				<view class="flex btn-join" @click="addGoods('cart')">加入购物车</view>
				<view class="flex btn-buy" @click="addGoods('buy')">立即购买</view>
			</view>
		</view>
		<modal-vue ref="modal"></modal-vue>
		<cart-modal-vue ref="cartModal"></cart-modal-vue>
	</view>
</template>

<script>
	import headerVue from '@/components/header.vue';
	import modalVue from './components/modal.vue';
	import cartModalVue from './components/cartModal.vue';
	import appConfig from '@/config/app.js'

	export default {
		data() {
			return {
				IMAGE_URL: appConfig.IMAGE_URL,
				list: [],
				currentNum: 0,
				tabIndex: 0,
				showTip: false,
				tipInfo: [{
						icon: 'icon-clock-full',
						color: '#DF9824',
						title: '使用时间',
						des: ['仅工作日可用，周末、节假日不可以']
					},
					{
						icon: 'icon-file',
						color: '#0785CF',
						title: '使用规则',
						des: ['1.堂食餐前外带均可', '2.如部分菜品因时令或售罄等其他不可抗因素无法提供，请联系商家协调处理，感谢您的理解', '3.无需预约，消费高峰期可能需等位']
					},
				],
				bzInfo: [{
						icon: 'icon-hudun',
						color: '#0785CF',
						title: '七天无理由退货',
						des: ['满足相应条件（未使用、未拆包）时，消费者可申请“7天无理由退货”']
					},
					{
						icon: 'icon-hudun',
						color: '#0785CF',
						title: '退货宝',
						des: ['满足相应条件（未使用、未拆包）时，消费者可申请“7天无理由退货”']
					},
				],
				goodsInfo: [{
						title: '产品系列',
						des: '米粉'
					},
					{
						title: '成分特点',
						des: '米粉'
					},
					{
						title: '口感特色',
						des: '米粉'
					},
				]
			}
		},
		components: {
			headerVue,
			modalVue,
			cartModalVue
		},
		mounted() {

		},
		methods: {
			showModal(title, list, mode) {
				this.$refs.modal.open(title, list, mode)
			},
			addGoods(type, info) {
				this.$refs.cartModal.open(type, info)
			},
			goPage(url) {
				uni.navigateTo({
					url
				});
			},
		}
	}
</script>

<style lang="scss" scoped>
	.btn-header .flex {
		width: 48rpx;
		height: 48rpx;
		background: rgba(0, 0, 0, 0.2);
		border-radius: 50%;
		color: $uni-text-color-inverse;
		margin-left: 20rpx;
	}

	.swiper {
		position: absolute;
		top: 0;
		width: 100%;
		height: 400rpx;
		z-index: -1;

		.indicator-num {
			width: 54rpx;
			height: 30rpx;
			background: rgba(0, 0, 0, 0.2);
			border-radius: 4rpx;
			color: $uni-text-color-inverse;
		}
	}

	.detail {
		background: #F6F6F6;
		position: absolute;
		top: 400rpx;
		width: 100%;
		padding-bottom: calc(env(safe-area-inset-bottom) + 88rpx);

		.white-box {
			padding: 28rpx 32rpx;
			box-sizing: border-box;
			background: $uni-bg-color;
			margin-bottom: 20rpx;

			.font24 {
				color: $uni-text-color-grey;
			}

			.line {
				height: 72rpx;
				width: 2rpx;
				border-left: 1rpx dashed $uni-text-color-grey;
				margin: 0 40rpx;
			}

			.item {
				border-top: 1rpx solid #DDDDDD;
				padding: 28rpx 0;

				&:nth-child(1) {
					border: 0;
				}

				image {
					width: 28rpx;
					height: 28rpx;
					margin-right: 8rpx;
				}

				.bz-line {
					margin: 0 12rpx;
					height: 24rpx;
					background: #DDDDDD;
					width: 1rpx;
				}
			}

			.title {
				color: $uni-text-color;
			}

			.cover {
				width: 160rpx;
				height: 160rpx;
				border-radius: 20rpx;
				margin-right: 20rpx;
				flex-shrink: 0;
			}

			.store {
				height: 160rpx;
				align-items: flex-start;
				width: 100%;
			}

			.store-title {
				margin-bottom: 12rpx;
			}

			.fans {
				color: $uni-text-color-grey;
				width: 100%;
			}

			.btn-guanzhu {
				width: 152rpx;
				height: 58rpx;
				background: #DF9824;
				box-shadow: 0rpx 4rpx 12rpx 0rpx rgba(223, 152, 36, 0.08);
				border-radius: 60rpx;
				color: $uni-text-color-inverse;

				.icon-add {
					margin-right: 4rpx;
				}
			}

			.address {
				border-top: 1rpx solid #DDDDDD;
				margin-top: 20rpx;
				color: $uni-text-color-grey1;

				.iconfont {
					margin-right: 8rpx;
					color: #DF9824;
				}

				.mt-20 {
					margin-top: 20rpx;
				}
			}
		}

		.goods-list {

			.tab {
				color: $uni-text-color-grey1;
				margin-bottom: 30rpx;
				justify-content: flex-start;

				.column {
					margin-right: 60rpx;
				}

				.icon-tab-circle {
					width: 26rpx;
					height: 12rpx;
					margin-top: 6rpx;
					font-size: 12rpx;
					color: $uni-text-color-inverse;
				}

				.active {
					color: $uni-text-color;
					font-size: 30rpx;
					font-weight: 500;

					.icon-tab-circle {
						color: $uni-color-primary;
					}
				}
			}
		}

		.list {
			margin-bottom: 28rpx;
			padding: 20rpx;
			box-sizing: border-box;
			box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(0, 0, 0, 0.08);
			border-radius: 20rpx;
			
			.store-title {
				border-bottom: 1rpx solid #DDDDDD;
				padding-bottom: 20rpx;
				box-sizing: border-box;
			}

			.iconfont {
				margin-right: 4rpx;
			}

			.time-red-box {
				width: 30rpx;
				height: 30rpx;
				background: linear-gradient(155deg, #F54F4F 0%, #F07474 100%);
				border-radius: 6rpx;
				color: $uni-text-color-inverse;
				margin: 0 8rpx;
			}

			image {
				width: 200rpx;
				height: 200rpx;
				border-radius: 16rpx;
				margin-right: 20rpx;
				flex-shrink: 0;
			}

			.price {
				color: $uni-text-color-red;
				align-items: baseline;
			}

			.store-info {
				width: 100%;
				height: 200rpx;
				align-items: flex-start;

				.tag {
					padding: 0 8rpx;
					height: 28rpx;
					box-sizing: border-box;
					background: #DF9824;
					border-radius: 4rpx;
					margin-right: 8rpx;
					color: $uni-text-color-inverse;
				}

				.sale-num {
					color: $uni-text-color-grey;
					margin-top: 20rpx;
				}

				.num {
					color: $uni-text-color-grey1;
					width: 100%;
				}

				.icon-comment {
					margin-left: 26rpx;
				}
			}
		}
	}

	.fixed {
		position: fixed;
		width: 100%;
		height: 88rpx;
		background: $uni-bg-color;
		padding: 0 32rpx;
		box-sizing: border-box;
		bottom: env(safe-area-inset-bottom);
		box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(0, 0, 0, 0.1);

		.item {
			margin-right: 24rpx;
		}

		.btn-buy,
		.btn-join {
			width: 228rpx;
			height: 76rpx;
			border-radius: 60rpx;
			color: $uni-text-color-inverse;
		}

		.btn-buy {
			background: linear-gradient(90deg, #0785CF 0%, #25A4EF 100%);
			box-shadow: 0rpx 4rpx 20rpx 0rpx rgba(7, 133, 207, 0.1);
		}

		.btn-join {
			margin-right: 20rpx;
			background: linear-gradient(90deg, #DF9824 0%, #F4B042 100%);
			box-shadow: 0rpx 4rpx 20rpx 0rpx rgba(223, 152, 36, 0.1);
		}
	}
</style>